<template>
	<view class="find" :style="{
		backgroundColor: common.appStyle.find_bg_color ? common.appStyle.find_bg_color : '#f7f7f7',
		backgroundImage: 'url(' + $wanlshop.oss(common.appStyle.find_bg_image, 0, 50, 1, 'transparent', 'png') + ')'
	}">
		<!-- 导航条 -->
		<view class="cu-custom" :style="{ height: wanlsys.height + 'px' }">
			<view class="cu-bar" :style="{ height: wanlsys.height + 'px', paddingTop: wanlsys.top + 'px', color: common.appStyle.find_font_color == 'light' ? '#ffffff' : '#333333' }" >
				<view class="action">
					<!-- #ifndef MP -->
					<text class="wlIcon-fanhui1" style="margin-left: 0;" @tap="goBack"></text>
					<!-- #endif -->
					<!-- #ifdef MP -->
					<!-- <text class="wlIcon-zan1" style="margin-left: 0; margin-right: 0;" @tap="$wanlshop.auth('/pages/find/lists')"></text> -->
					<!-- <text class="wlIcon-xiaoxizhongxin" @tap="$wanlshop.to('/pages/notice/notice')"></text> -->
					<!-- <view class="cu-tag badge" v-if="statistics.notice.chat > 0">{{ statistics.notice.chat }}</view> -->
					<!-- #endif -->
				</view>
				<view class="content" :style="{top: wanlsys.top + 'px'}">
					<text class="text-xl">报名列表</text>
				</view>
				<!-- #ifndef MP -->
				<view class="action">
					<!-- <text class="wlIcon-zan1" @tap="$wanlshop.auth('/pages/find/lists')"></text> -->
					<!-- <text class="wlIcon-xiaoxizhongxin" @tap="$wanlshop.to('/pages/notice/notice')"></text> -->
					<!-- <view class="cu-tag badge" v-if="statistics.notice.chat > 0">{{ statistics.notice.chat }}</view> -->
				</view>
				<!-- #endif -->
			</view>
		</view>
		<view class="edgeInsetTop"></view>
				<view class="wanl-goods-comment">
					<!-- <wanl-empty text="没有找到团队列表" v-if="listData.length == 0"></wanl-empty> -->
			
					<block v-for="(item, index) in 10" :key="index">
						<view class="lsit">
						
							<view class="image" >
								
							</view>
							<view class="ddd">
								<view class="top1">
									<text>大哥</text>
								</view>
								<view class="top2">
									<text>185****6666</text>
								</view>
								<view class="top2">
									<text>6666666666666666666</text>
								</view>
							</view>
						</view>
					</block>
					<!-- <uni-load-more :status="status" :content-text="contentText" /> -->
				</view>
			
		</view>
	
	

	
	</view>
</template>

<script>
import { mapState } from 'vuex';
export default {
computed: {
		...mapState(['common', 'user', 'statistics'])
	},
	data() {
		return {
			wanlsys: this.$wanlshop.wanlsys(),
			height: null,
			typeList: {
				new: 'bg-gradual-yellow',
				live: 'wanl-bg-orange',
				want: 'bg-gradual-green',
				activity: 'bg-gradual-orange',
				show: 'wanl-bg-pink'
			},
			tabCur: 0,
			scrollLeft: 0,
			scrollTop: 0,
			tabData: []
		};
	}, 
	onShow() {
		setTimeout(()=> {
			uni.setNavigationBarColor({  
				frontColor: this.$store.state.common.appStyle.find_font_color == 'light'?'#ffffff':'#000000',  
				backgroundColor: this.$store.state.common.appStyle.find_bg_color
		    })  
		}, 200);
	},
	onLoad() {
		// #ifdef APP-PLUS
		this.height = this.wanlsys.windowHeight + this.wanlsys.windowBottom - this.wanlsys.height - 32;
		// #endif
		// #ifdef H5
		this.height = this.wanlsys.windowHeight + this.wanlsys.windowBottom - this.wanlsys.height - 50 - 32;
		// #endif
		// #ifdef MP
		this.height = this.wanlsys.windowHeight - this.wanlsys.height - 32;
		// #endif
		this.loadMenu();
	},
	methods: {
		goBack(){
			uni.navigateBack({
				delta: 1
			});
		},
		// 点击选择
		tabSelect(key) {
			this.tabCur = key;
			this.scrollLeft = (key - 1) * 60;
		},
		// 监听滑动选择
		onTabchange(e) {
			this.tabCur = e.detail.current;
			if (this.tabData[this.tabCur].data.length == 0) {
				this.loadData();
			}
		},
		async loadMenu() {
			this.$api.get({
				url: '/wanlshop/find/menu',
				data: {
					// #ifdef APP-PLUS
					device: 'app',
					// #endif
					// #ifdef MP
					device: 'mp',
					// #endif
					// #ifdef H5
					device: 'h5',
					// #endif
				},
				success: res => {
					this.tabData = res;
					this.loadData();
				}
			});
		},
		async loadData() {
			let find = this.tabData[this.tabCur];
			this.$api.get({
				url: '/wanlshop/find/find',
				data: {
					page: find.current_page,
					type: find.id
				},
				success: res => {
					// 判断是否上拉状态
					if (find.triggered) {
						//触发onRestore，并关闭刷新图标
						find.triggered = false; 
						find._freshing = false;
						find.data = res.data;
					}else{
						find.data = find.data.concat(res.data);
					}
					//当前页码
					find.current_page = res.current_page; 
					//总页码
					find.last_page = res.last_page; 
					find.status = res.total == 0 ? 'noMore':'more';
				}
			});
		},
		// 下拉刷新
		onRefresh() {
			if (this.tabData[this.tabCur]._freshing) return;
			this.tabData[this.tabCur]._freshing = true;
			if (!this.tabData[this.tabCur].triggered)
				//界面下拉触发，triggered可能不是true，要设为true
				this.tabData[this.tabCur].triggered = true;
				this.tabData[this.tabCur].current_page = 1;
				this.loadData();
		},
		// 上拉加载更多
		onTolower() {
			//判断是否最后一页
			if (this.tabData[this.tabCur].current_page >= this.tabData[this.tabCur].last_page) {
				this.tabData[this.tabCur].status = 'noMore';
			} else {
				this.tabData[this.tabCur].current_page = this.tabData[this.tabCur].current_page + 1; //页码+1
				this.tabData[this.tabCur].status = 'loading';
				this.loadData();
			}
		},
		// 监听滚动
		onScroll(e){
			this.scrollTop = e.detail.scrollTop;
		},
		// 格式化html
		formatHtml(content){
			return (content.replace(/<\/?.+?>/g,"").replace(/ /g,""));
		},
		// 关注 & 取消关注
		onFollow(index, key){
			var find = this.tabData[index].data;
			find[key].isFollow = !find[key].isFollow;
			// 后续版本遍历整个find
			this.$api.post({
				url: '/wanlshop/shop/follow',
				data: {
					id: find[key].shop_id
				},
				success: res => {
					find[key].isFollow = res;
				}
			});
		},
		// 喜欢 & 取消喜欢
		onLike(index, key){
			var find = this.tabData[index].data[key];
			find.isLike = !find.isLike;
			if (find.isLike) {
				find.like += 1;
			}else{
				find.like -= 1;
			}
			this.$api.post({
				url: '/wanlshop/find/setFollow',
				data: {
					id: find.id
				},
				success: res => {
					find.isLike = res;
				}
			});
		},
		//预览图片
		previewImage(image, index) {
			var imgArr = [];
			for (var item of image) {
				imgArr = imgArr.concat(this.$wanlshop.oss(item, 500));
			}
			uni.previewImage({
				urls: imgArr,
				current: imgArr[index],
				indicator: 'number'
			});
		}
	}
			
	

	
	
};
</script>

<style  lang="scss" scoped>
	
	.lsit {
		width: 690rpx;
		//height: 100rpx;
		background: #ffffff;
		border-radius: 10rpx;
		padding: 10rpx 0rpx;
		margin: 30rpx auto;
		display: flex;
		align-items: center;
		justify-content: flex-start;
		.image {
			width: 120rpx;
			height: 120rpx;
			background: #eeca86;
			border-radius: 50%;
			margin-left: 21rpx;
			
		}
		.ddd{
			flex: 1;
			display: flex;
			flex-direction: column;
			.top1,.top2{
				width: 100%;
				display: flex;
				justify-content: space-between;
			}
			.top1 {
				text {
					font-weight: 700;
					color: #000;
				}
			}
			.top2 {
				text {
					font-weight: 500;
					color: #4C4C4C;
				}
			}
		}
		
		
		text {
			margin-left: 21rpx;
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
		}
	}
	
	
	
	.navTab{
		padding: 10rpx 80rpx 0rpx 80rpx;
	}
	.find{
		background-repeat: no-repeat;
		background-size: 100%;
	}
	.cu-custom .cu-bar .action {
		position: relative;
	}
	.userinfo .avatar .cu-tag{
		padding: 0px 6rpx;
		height: 34rpx;
	}
	.wanl-find-head{
		line-height: 1;
	}
	.wanl-find-head .shopname{
		font-size: 31rpx;
		color: #000000;
	}
</style>
